import { HttpResponse, http } from "msw";

export function mockTodolIst(todoList:any) {
    return http.get("http://localhost/api/todoList",async () => {
        return HttpResponse.json({
            data:{ todoList }
        })
    })
}
export function mockRemoveTodo() {
    return http.post("http://localhost/api/removeTodo",async ({ request }) => {
        const { id } = await request.json() as any;
        return HttpResponse.json({
            data: { id  },
            state: 1,
        });
    })
}
export function mockAddTodo() {
    return http.post("http://localhost/api/addTodo", async ({ request }) => {
        const { title } = await request.json() as any;
        return HttpResponse.json({
        data: { todo: { id: 1, title } },
        state: 1,
        });
    })
}